package com.fadadianqi.logistics.inventory.dao.ibatis;

import com.fadadianqi.commons.GenericDAOSuport;
import com.fadadianqi.logistics.inventory.dao.StorehouseDAO;
import com.fadadianqi.logistics.inventory.model.Storehouse;
import com.yeqiangwei.commons.util.Pagination;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StorehouseDAOImpl extends GenericDAOSuport<String, Storehouse>
        implements StorehouseDAO {

    @Override
    protected Class<?> getObjectClass() {
        return Storehouse.class;
    }

    @Override
    protected String getTableName() {
        return "storehouse";
    }

    @Override
    public List<Storehouse> findAll() {
        Pagination pagination = new Pagination(1, Integer.MAX_VALUE);
        pagination.setOrderList(new Pagination.Order[]{Pagination.getNewOrder("id", Pagination.Order.DESCENDING)});
        return super.findAll(pagination);
    }

}
